package org.shilong.logic.party;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.shilong.Utilitys.Strings.Constants;
import org.shilong.mContext.db.DBContext;
import org.shilong.model.PartyModel;

public class QueryMyPartyLogic {

	private static List<PartyModel> mList = null;

	public static List<PartyModel> getRlt(String... args) {

		mList = null;

		mList = new ArrayList<PartyModel>();

		Connection conn = null;

		CallableStatement cst = null;

		ResultSet rs = null;

		conn = DBContext.createInstance(DBContext.TYPE_MYSQL).getConnector();

		try {
			cst = conn.prepareCall(Constants.QUERY_MY_PARTY);

			cst.setString(1, args[0]);

			rs = cst.executeQuery();

			while (rs.next()) {

				PartyModel bean = new PartyModel();

				bean.setPa_seq_id(rs.getInt("pa_seq_id"));
				bean.setPa_type(rs.getString("type"));
				bean.setPa_comment(rs.getString("pa_comment"));
				bean.setPa_end_time(rs.getString("pa_end_time"));
				bean.setPa_start_time(rs.getString("pa_start_time"));
				bean.setPa_title(rs.getString("pa_title"));

				mList.add(bean);
			}

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {

			try {

				if (rs != null) {
					rs.close();
					rs = null;
				}

				if (cst != null) {
					cst.close();
					cst = null;
				}

			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}

		return mList;
	}

}
